#include <iostream>
#include <fstream>
#include <string>
using namespace std;

class Person {
public:
    char name[64];
    int age;
};

int main() {
    ofstream ofs;
    ofs.open("test2.txt", ios::out | ios::binary);
    Person p = {"张三", 18};
    ofs.write( (const char *)&p, sizeof(Person));
    ofs.close();
    return 0;
}